#ifndef __SYS_TEM_H__
#define __SYS_TEM_H__

#include "main.h"
#include "https_laohuangli.h"
#include "https_shijian.h"
#include "https_tianqi.h"
#include "https_riluo.h"
#include "https_kongqi.h"
#include "board_def.h"
#include "https_bilibili.h"


#if 1 
  #define SYSTEM_DEBUG(format, args...) ESP_LOGW("[SYSTEM]- "," %s:%d\r\n",__FILE__, __LINE__);printf(format, ## args );
#else
  #define SYSTEM_DEBUG(format, args...) ;
#endif

typedef struct
{

    int sd_sta;
    int sht20_sta;
    int ft5206_sta;
    int spiffs_sta;
    int nvs_sta;
    int wm8978_sta;
    int mpu6050_sta;

    uint8_t MAC[6];
    char ip[30];
    char ziwangyanma[30];
    char wangguan[30];
    char wifi_name[32];
    char wifi_password[64];


    char IP_ADDR[30];
    char City[30];

    //wifi链接成功事件
    EventGroupHandle_t wifi_event_group;
    EventGroupHandle_t Wav_event_group;
    EventGroupHandle_t TianQi_event_group;

    xSemaphoreHandle  https_request_Semaphore;


    _Weather_Data   Weather_Data[3];
    _kongqi_Data    kongqi_Data;
    _RiLuo_Data     RiLuo_Data[3];
    _RiQi_Data      RiQi_Data;
    _laohuangli_data laohuangli_data;

    _bilibili_Data bilibili_Data;

    //SHT2x_data SHT20;

    int Temp;
    int Humi;
    int HuoQu_TianQi_Flag;
    int HuoQu_ShiJian_Flag;
    int HuoQu_LaoHuangLi_Flag;
    int HuoQu_bilibili_Flag;
    int WIFI_Sta;//WIFI连接状态
    int web_huoqu_tianqi_flag;
    int wifi_scan_flag;

	  int Language;
    int wifi_scan_list_cnt;
    wifi_ap_record_t wifi_ap_info[WIFI_SCAN_LIST_SIZE];	// AP信息结构体大小

    int wifi_kaiguan;
}_SYSTEM_State;

extern _SYSTEM_State SYSTEM_State;

#define SYSTEM_LANGUAGE_NUM 4
enum Language_Num {
	JianTiZhongWen = 0,
	FanTiZhongWen,
	YingWen,
	QiTa,
};


int SYSTEM_INIT(void);
int SYSTEM_Set_Language(int dat);
int SYSTEM_Get_Language(void);
int SYSTEM_Set_wifi_kaiguan(int dat);
int SYSTEM_Get_wifi_kaiguan(void);

#endif